package com.hzp.lolnews.activity.presenter;

import android.content.Context;

import com.hzp.lolnews.activity.model.LoginBiz;
import com.hzp.lolnews.activity.model.OnLoginListener;
import com.hzp.lolnews.activity.model.OnLoginRegisterListener;
import com.hzp.lolnews.activity.view.ILoginView;
import com.hzp.lolnews.base.IBasePresenter;


public class LoginPresenter implements IBasePresenter{

    private LoginBiz mLoginBiz;
    //登录视图--->Activity
    private ILoginView mView;

    private Context mContext;
    public LoginPresenter(Context context,ILoginView view) {
        mLoginBiz = new LoginBiz();
        this.mView = view;
        this.mContext = context;
    }



    //登录
    public void login() {
        mLoginBiz.login(mContext,mView.getUserName(), mView.getPassWord(), new OnLoginListener() {
            @Override
            public void loginSucceed() {
                mView.toSucceedActivity();
            }

            @Override
            public void loginFailed() {
                mView.showLoginFailedView();
            }
        });


    }

    //重置
    public void register(){
        mLoginBiz.register(new OnLoginRegisterListener() {
            @Override
            public void register() {
                mView.register();
            }
        });
    }


}
